package org.taobao.ibatiside.codegen;

import org.apache.commons.lang.StringUtils;

public class ConfigV2SampleGen
{
  protected static String nl;
  public static synchronized ConfigV2SampleGen create(String lineSeparator)
  {
    nl = lineSeparator;
    ConfigV2SampleGen result = new ConfigV2SampleGen();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + NL + "<!DOCTYPE sqlMapConfig PUBLIC \"-//ibatis.apache.org//DTD SQL Map Config 2.0//EN\" \"http://ibatis.apache.org/dtd/sql-map-config-2.dtd\">" + NL + "" + NL + "<sqlMapConfig>" + NL + "\t";
  protected final String TEXT_2 = NL + "\t\t<sqlMap resource=\"";
  protected final String TEXT_3 = "\" />" + NL + "\t";
  protected final String TEXT_4 = NL + "</sqlMapConfig>";

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    
ConfigSampleModel model = (ConfigSampleModel)argument;

    stringBuffer.append(TEXT_1);
     for (String map : model.getSqlmaps()){
    stringBuffer.append(TEXT_2);
    stringBuffer.append(map);
    stringBuffer.append(TEXT_3);
    }
    stringBuffer.append(TEXT_4);
    return stringBuffer.toString();
  }
}
